* @edge: the edge or corner from which the drag is started
* @device: the device used for the operation
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
- * @root_x: root window X coordinate of mouse click that began the drag
- * @root_y: root window Y coordinate of mouse click that began the drag
+ * @x: surface X coordinate of mouse click that began the drag
+ * @y: surface Y coordinate of mouse click that began the drag
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
*
* Begins a surface resize operation (for a toplevel surface).
- * You might use this function to implement a “window resize grip,” for
- * example; in fact #GtkStatusbar uses it. The function works best
- * with window managers that support the
- * [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec)
- * but has a fallback implementation for other window managers.
+ * You might use this function to implement a “window resize grip,”
*/
void
gdk_surface_begin_resize_drag_for_device (GdkSurface *surface,
GdkSurfaceEdge edge,
- GdkDevice *device,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+ GdkDevice *device,
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp)
{
- GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->begin_resize_drag (surface, edge, device, button, root_x, root_y, timestamp);
+ GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->begin_resize_drag (surface, edge, device, button, x, y, timestamp);
}
/**
* @surface: a toplevel #GdkSurface
* @edge: the edge or corner from which the drag is started
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
- * @root_x: root window X coordinate of mouse click that began the drag
- * @root_y: root window Y coordinate of mouse click that began the drag
+ * @x: surface X coordinate of mouse click that began the drag
+ * @y: surface Y coordinate of mouse click that began the drag
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
*
* Begins a surface resize operation (for a toplevel surface).
void
gdk_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp)
{
GdkDisplay *display;
GdkDevice *device;
display = gdk_surface_get_display (surface);
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
gdk_surface_begin_resize_drag_for_device (surface, edge,
- device, button, root_x, root_y, timestamp);
+ device, button, x, y, timestamp);
}
/**
* @surface: a toplevel #GdkSurface
* @device: the device used for the operation
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
- * @root_x: root window X coordinate of mouse click that began the drag
- * @root_y: root window Y coordinate of mouse click that began the drag
+ * @x: surface X coordinate of mouse click that began the drag
+ * @y: surface Y coordinate of mouse click that began the drag
* @timestamp: timestamp of mouse click that began the drag
*
* Begins a surface move operation (for a toplevel surface).
- * You might use this function to implement a “window move grip,” for
- * example. The function works best with window managers that support the
- * [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec)
- * but has a fallback implementation for other window managers.
*/
void
gdk_surface_begin_move_drag_for_device (GdkSurface *surface,
- GdkDevice *device,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+ GdkDevice *device,
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp)
{
GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->begin_move_drag (surface,
- device, button, root_x, root_y, timestamp);
+ device, button, x, y, timestamp);
}
/**
* gdk_surface_begin_move_drag:
* @surface: a toplevel #GdkSurface
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
- * @root_x: root window X coordinate of mouse click that began the drag
- * @root_y: root window Y coordinate of mouse click that began the drag
+ * @x: surface X coordinate of mouse click that began the drag
+ * @y: surface Y coordinate of mouse click that began the drag
* @timestamp: timestamp of mouse click that began the drag
*
* Begins a surface move operation (for a toplevel surface).
void
gdk_surface_begin_move_drag (GdkSurface *surface,
gint button,
- gint root_x,
- gint root_y,
+ gint x,
+ gint y,
guint32 timestamp)
{
GdkDisplay *display;
display = gdk_surface_get_display (surface);
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
- gdk_surface_begin_move_drag_for_device (surface, device, button, root_x, root_y, timestamp);
+ gdk_surface_begin_move_drag_for_device (surface, device, button, x, y, timestamp);
}
/**
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp);
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_resize_drag_for_device (GdkSurface *surface,
GdkSurfaceEdge edge,
- GdkDevice *device,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp);
+ GdkDevice *device,
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_move_drag (GdkSurface *surface,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp);
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_move_drag_for_device (GdkSurface *surface,
- GdkDevice *device,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp);
+ GdkDevice *device,
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp);
/* Interface for dirty-region queueing */
GDK_AVAILABLE_IN_ALL
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
- gint root_x,
- gint root_y,
+ gint x,
+ gint y,
guint32 timestamp)
{
GdkSurfaceImplWayland *impl;
gdk_wayland_surface_begin_move_drag (GdkSurface *surface,
GdkDevice *device,
gint button,
- gint root_x,
- gint root_y,
+ gint x,
+ gint y,
guint32 timestamp)
{
GdkSurfaceImplWayland *impl;
}
static void
-emulate_move_drag (GdkSurface *surface,
- GdkDevice *device,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+emulate_move_drag (GdkSurface *surface,
+ GdkDevice *device,
+ gint button,
+ gint root_x,
+ gint root_y,
+ guint32 timestamp)
{
MoveResizeData *mv_resize = get_move_resize_data (GDK_SURFACE_DISPLAY (surface), TRUE);
static void
gdk_x11_surface_begin_resize_drag (GdkSurface *surface,
- GdkSurfaceEdge edge,
- GdkDevice *device,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+ GdkSurfaceEdge edge,
+ GdkDevice *device,
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp)
{
+ int root_x, root_y;
+
if (GDK_SURFACE_DESTROYED (surface) ||
!SURFACE_IS_TOPLEVEL (surface))
return;
+ gdk_surface_x11_get_root_coords (surface, x, y, &root_x, &root_y);
+
/* Avoid EWMH for touch devices */
if (_should_perform_ewmh_drag (surface, device))
wmspec_resize_drag (surface, edge, device, button, root_x, root_y, timestamp);
static void
gdk_x11_surface_begin_move_drag (GdkSurface *surface,
- GdkDevice *device,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+ GdkDevice *device,
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp)
{
+ int root_x, root_y;
gint direction;
if (GDK_SURFACE_DESTROYED (surface) || !SURFACE_IS_TOPLEVEL (surface))
else
direction = _NET_WM_MOVERESIZE_MOVE;
+ gdk_surface_x11_get_root_coords (surface, x, y, &root_x, &root_y);
+
/* Avoid EWMH for touch devices */
if (_should_perform_ewmh_drag (surface, device))
wmspec_moveresize (surface, direction, device, button, root_x, root_y, timestamp);
default:
if (!priv->maximized)
{
- gdouble x_root, y_root;
-
+ double x, y;
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
- gdk_event_get_root_coords (event, &x_root, &y_root);
+ gdk_event_get_coords (event, &x, &y);
gdk_surface_begin_resize_drag_for_device (_gtk_widget_get_surface (widget),
(GdkSurfaceEdge) region,
gdk_event_get_device ((GdkEvent *) event),
GDK_BUTTON_PRIMARY,
- x_root, y_root,
+ x, y,
gdk_event_get_time (event));
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
- gdk_surface_get_root_coords (_gtk_widget_get_surface (GTK_WIDGET (window)),
- start_x, start_y, &x_root, &y_root);
gdk_surface_begin_move_drag_for_device (_gtk_widget_get_surface (GTK_WIDGET (window)),
gtk_gesture_get_device (GTK_GESTURE (gesture)),
gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)),
- x_root, y_root,
+ (int)start_x, (int)start_y,
gtk_get_current_event_time ());
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
* @window: a #GtkWindow
* @button: mouse button that initiated the drag
* @edge: position of the resize control
- * @root_x: X position where the user clicked to initiate the drag, in root window coordinates
- * @root_y: Y position where the user clicked to initiate the drag
+ * @x: X position where the user clicked to initiate the drag, in window coordinates
+ * @y: Y position where the user clicked to initiate the drag
* @timestamp: timestamp from the click event that initiated the drag
*
* Starts resizing a window. This function is used if an application
- * has window resizing controls. When GDK can support it, the resize
- * will be done using the standard mechanism for the
- * [window manager][gtk-X11-arch] or windowing
- * system. Otherwise, GDK will try to emulate window resizing,
- * potentially not all that well, depending on the windowing system.
+ * has window resizing controls.
*/
void
-gtk_window_begin_resize_drag (GtkWindow *window,
- GdkSurfaceEdge edge,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+gtk_window_begin_resize_drag (GtkWindow *window,
+ GdkSurfaceEdge edge,
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp)
{
GtkWidget *widget;
GdkSurface *toplevel;
toplevel = _gtk_widget_get_surface (widget);
- gdk_surface_begin_resize_drag (toplevel,
- edge, button,
- root_x, root_y,
- timestamp);
+ gdk_surface_begin_resize_drag (toplevel, edge, button, x, y, timestamp);
}
/**
* gtk_window_begin_move_drag:
* @window: a #GtkWindow
* @button: mouse button that initiated the drag
- * @root_x: X position where the user clicked to initiate the drag, in root window coordinates
- * @root_y: Y position where the user clicked to initiate the drag
+ * @x: X position where the user clicked to initiate the drag, in window coordinates
+ * @y: Y position where the user clicked to initiate the drag
* @timestamp: timestamp from the click event that initiated the drag
*
* Starts moving a window. This function is used if an application has
- * window movement grips. When GDK can support it, the window movement
- * will be done using the standard mechanism for the
- * [window manager][gtk-X11-arch] or windowing
- * system. Otherwise, GDK will try to emulate window movement,
- * potentially not all that well, depending on the windowing system.
+ * window movement grips.
*/
void
-gtk_window_begin_move_drag (GtkWindow *window,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+gtk_window_begin_move_drag (GtkWindow *window,
+ gint button,
+ gint x,
+ gint y,
+ guint32 timestamp)
{
GtkWidget *widget;
GdkSurface *toplevel;
toplevel = _gtk_widget_get_surface (widget);
- gdk_surface_begin_move_drag (toplevel,
- button,
- root_x, root_y,
- timestamp);
+ gdk_surface_begin_move_drag (toplevel, button, x, y, timestamp);
}
/**
void gtk_window_begin_resize_drag (GtkWindow *window,
GdkSurfaceEdge edge,
gint button,
- gint root_x,
- gint root_y,
+ gint x,
+ gint y,
guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gtk_window_begin_move_drag (GtkWindow *window,
gint button,
- gint root_x,
- gint root_y,
+ gint x,
+ gint y,
guint32 timestamp);
/* Set initial default size of the window (does not constrain user